/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package window;

import com.inet.editor.BaseEditor;
import java.io.File;
import java.net.MalformedURLException;
import java.net.URI;

/**
 *
 * @author Arcanis
 */
public class HelpDialog extends javax.swing.JDialog {

    /**
     * Creates new form HelpDialog
     */
    public HelpDialog(java.awt.Frame parent, boolean modal) {
        super(parent, modal);
        initComponents();

        BaseEditor ed = new BaseEditor(true, false, false, true);
        jPanel1.add(ed);
        File file = new File("help/help.html");        
        try {            
//            URI u = new URI("http://www.stud.fit.vutbr.cz/~xjanec11/GJA/");
//            ed.setPage(u.toURL());
            if (file.exists()) {
                ed.setPage(file.toURI().toURL());
            } else {
                throw new MalformedURLException();
            }
        } catch (Exception ex) {
            ed.setText("<h1>Error loading file <i>" + file.getPath() + "</i><h1>", true);
        }


    }

    /**
     * This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        jPanel1 = new javax.swing.JPanel();

        setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
        setTitle("Uživatelský manuál");

        jPanel1.setLayout(new java.awt.GridLayout(1, 0));

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, 650, Short.MAX_VALUE)
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, 505, Short.MAX_VALUE)
        );

        pack();
    }// </editor-fold>//GEN-END:initComponents
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JPanel jPanel1;
    // End of variables declaration//GEN-END:variables
}
